package br.ufrj.dcc.smarthotel.listeners;

import java.util.Hashtable;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import br.ufrj.dcc.smarthotel.activities.EventDetailActivity;
import br.ufrj.dcc.smarthotel.activities.EventsMenuActivity;
import br.ufrj.dcc.smarthotel.entities.Event;

public class EventItemClickListener implements OnItemClickListener {
	private EventsMenuActivity activity;
	
	public EventItemClickListener (EventsMenuActivity activity) {
		this.activity = activity;
	}
	
	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
		Event clickedEvent = this.activity.getEventsList().get(position);
		
		Hashtable<String, String> params = new Hashtable<String, String>();
		
		params.put("clickedEventId", String.valueOf(clickedEvent.getEventId()));
		
		this.activity.startActivity(EventDetailActivity.class, params, 1);
	}
}
